package com.jufanshare.myblog.service.request;

import com.jufanshare.myblog.common.util.IPUtil;
import com.jufanshare.myblog.entity.Request;
import com.jufanshare.myblog.service.base.BaseServiceImpl;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

/**
 * @功能：
 * @开发者： 大BUG
 * @编写时间： 2019/1/28 10:36
 */
@Service
public class RequestServiceImpl extends BaseServiceImpl<Request> implements RequestService {
    @Async
    @Override
    public void asyncInsert(HttpServletRequest servletRequest) {
        Request request=new Request(IPUtil.getIpAddr(servletRequest),servletRequest.getServletPath(),new Date());
        insert(request);
    }
    @Async
    @Override
    public void asyncInsert(HttpServletRequest servletRequest, Request request) {
        Request request2=new Request(IPUtil.getIpAddr(servletRequest),servletRequest.getServletPath(),new Date());
        request2.setRequrl(request.getRequrl());
        insert(request2);
    }
}
